package com.codejiwei.core.rdd

import org.apache.spark.{SparkConf, SparkContext}

object Spark_Operator_SortBy {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local[*]").setAppName("SortBy")
    val sc = new SparkContext(conf)
    val rdd = sc.makeRDD(List(1, 2, 3, 7, 4, 9, 10, 5), 3)

    val rdd1 = rdd.sortBy(num => num, false)

    println(rdd1.collect().mkString(", "))
//    rdd1.saveAsTextFile("output")

    sc.stop()
  }
}
